
function SelectNode(id,value){

		this.id = id;
		this.value = value;
		this.childs =[];
        
        this.point = null;

        this.add = function(selectNode){
            this.childs[this.childs.length] = selectNode;
			return this;
		    }

        this.get = function(i){
		    return this.childs[i];
			}

		 this.getSize = function() { return this.childs.length;}
}

function findId(id){

  return document.getElementById(id);

}

function setDefaultValue(value,obj_id,point_obj,_ids){
  obj = findId(obj_id);
  if (point_obj == null) return;
  obj.options[value + 1].selected = true; 
  select_option_reset(value ,point_obj ,_ids);
}
function select_option_reset (value,point_obj,_ids){

  if(value == -1){
   for(i=0;  Math.min(i, _ids.length)!= _ids.length ;i++){
       child = findId(_ids[i]);
	   select_option_delete(child);
    }
//	select_all_option(point_obj,ids);
	return false;
  }
  
  
  if (_ids.length == 0 ) return ;

   for(i=0; Math.min(i,_ids.length)!=_ids.length ;i++){
       child = findId(_ids[i]);
	   select_option_delete(child);
   }
   target_Date = point_obj.get(value);

   point_obj.point = target_Date;

   select_option_add(findId(_ids[0]),target_Date);

}

function select_option_add(select_obj,optionpro)
{
   
	if(optionpro == null ) return ;

	for (sh=0;Math.min(sh,optionpro.getSize())!= optionpro.getSize();sh++)
       {
            select_obj.options.add(new Option(optionpro.get(sh).value,optionpro.get(sh).id));
       }
}


function select_option_delete(select_obj)
{
 
    for (sh=select_obj.length-1;sh>0;sh--)
       {
           select_obj.options.remove(sh);
       }
    select_obj.click();
}
function getCurrentId(id){
id = findId(id);
_value = id.value;
return _value;

}

function getCurrentValue(id){
id = findId(id);
_value = id.options[id.selectedIndex].text ;
return _value;
}
